package com.yanqu.road.server.pb;

import com.yanqu.road.entity.assistant.*;
import com.yanqu.road.pb.assistant.AssistantSkinProto;

import java.util.List;

public class AssistantSkinPb {
    public static AssistantSkinProto.SeeOtherAssistantRespMsg.Builder parseSeeOtherAssistantRespMsg(AssistantBodySkin assistantBodySkin, List<UserAssistantDecoration> userAssistantDecorationList) {
        AssistantSkinProto.SeeOtherAssistantRespMsg.Builder msgBuilder = AssistantSkinProto.SeeOtherAssistantRespMsg.newBuilder();
        //解析全身衣服数据
        AssistantSkinProto.AssistantBodyDecorationsMsg.Builder assistantBodyDecorationsMsg = parseAssistantBodyDecorationsMsg(assistantBodySkin);
        msgBuilder.setSkinData(assistantBodyDecorationsMsg);
        //解析top装饰数据
        for (UserAssistantDecoration userAssistantDecoration : userAssistantDecorationList) {
            AssistantSkinProto.HasAssistantDecorationsMsg.Builder decorationBuilder = AssistantSkinProto.HasAssistantDecorationsMsg.newBuilder();
            decorationBuilder.setDecorationId(userAssistantDecoration.getDecorationId());
            decorationBuilder.setDecorationLevel(userAssistantDecoration.getDecorationLevel());
            decorationBuilder.setDressScore(userAssistantDecoration.getDressScore());
            msgBuilder.addTopDecorations(decorationBuilder);
        }
        return msgBuilder;
    }

    public static AssistantSkinProto.AssistantBodyDecorationsMsg.Builder parseAssistantBodyDecorationsMsg(AssistantBodySkin assistantBodySkin) {
        AssistantSkinProto.AssistantBodyDecorationsMsg.Builder builder = AssistantSkinProto.AssistantBodyDecorationsMsg.newBuilder();
        builder.setCharacterId(assistantBodySkin.getCharacterId());
        builder.setClothesId(assistantBodySkin.getClothesId());
        builder.setFaceId(assistantBodySkin.getFaceId());
        builder.setFootId(assistantBodySkin.getFootId());
        builder.setHandId(assistantBodySkin.getHandId());
        builder.setHeadId(assistantBodySkin.getHeadId());
        builder.setPantsId(assistantBodySkin.getPantsId());
        builder.setOtherId(assistantBodySkin.getOtherId());
        builder.setDesktopId(assistantBodySkin.getDesktopId());
        return builder;
    }

    public static AssistantBodySkin parseAssistantBodyDecorations(AssistantSkinProto.AssistantBodyDecorationsMsg msg) {
        AssistantBodySkin assistantBodySkin = new AssistantBodySkin();
        assistantBodySkin.setCharacterId(msg.getCharacterId());
        assistantBodySkin.setClothesId(msg.getClothesId());
        assistantBodySkin.setPantsId(msg.getPantsId());
        assistantBodySkin.setFootId(msg.getFootId());
        assistantBodySkin.setHeadId(msg.getHeadId());
        assistantBodySkin.setFaceId(msg.getFaceId());
        assistantBodySkin.setHandId(msg.getHandId());
        assistantBodySkin.setOtherId(msg.getOtherId());
        return assistantBodySkin;
    }

    public static AssistantSkinProto.HasAssistantDecorationsMsg.Builder parseAssistantDecorationsMsg(UserAssistantDecoration userAssistantDecoration) {
        AssistantSkinProto.HasAssistantDecorationsMsg.Builder builder = AssistantSkinProto.HasAssistantDecorationsMsg.newBuilder();
        builder.setDecorationId(userAssistantDecoration.getDecorationId());
        builder.setDecorationLevel(userAssistantDecoration.getDecorationLevel());
        builder.setDressScore(userAssistantDecoration.getDressScore());
        return builder;
    }

    public static AssistantSkinProto.HasAssistantSuitsMsg.Builder parseAssistantSuitMsg(UserAssistantSuit userAssistantSuit) {
        AssistantSkinProto.HasAssistantSuitsMsg.Builder builder = AssistantSkinProto.HasAssistantSuitsMsg.newBuilder();
        builder.setSuitId(userAssistantSuit.getSuitId());
        builder.setSuitLevel(userAssistantSuit.getSuitLevel());
        return builder;
    }

}
